{% extends "page-twocol.html" %}
{% load kegweblib %}

{% block title %}session detail: {{ session.GetTitle}}{% endblock %}
{% block pagetitle %}{{ session.GetTitle}}{% endblock %}

{% block col-1 %}

<div class="kb-contentbox">
  <table border="0" class="kb-statstable">
    <tr>
      <th>When</th>
      <td>
        {{session.starttime}}
      </td>
    </tr>

    {% with session.keg_chunks.all as keg_chunks %}
    <tr>
      <th>Keg{{keg_chunks.count|pluralize}}</th>
      <td>
        {% for chunk in keg_chunks %}
          {% if chunk.keg %}
            <a href="{% url keg chunk.keg.seqn %}">Keg #{{ chunk.keg.seqn }} ({{ chunk.keg.type }})</a><br>
          {% endif %}
        {% endfor %}
      </td>
    </tr>
    {% endwith %}

    <tr>
      <th>Drink Count</th>
      <td>
        {{ session.drinks.valid.count }} pours,
        {{session.Volume.ConvertTo.Pint|floatformat:0}} pints
      </td>
    </tr>

    <tr>
      <th>Registered Drinkers</th>
      <td>
        {{ session.GetStats.registered_drinkers|length }} drinkers
      </td>
    </tr>

  </table>
  <p/>
    <div>
      {% for chunk in session.UserChunksByVolume %}
        {% if chunk.user %}
        <div class="kb-drink-box-mugshot">
          {% with chunk.user as drinker %}
            {% mugshot_box drinker 96 %}
          {% endwith %}
        </div>
        {% endif %}
      {% endfor %}
    </div>

</div>

{% endblock col-1 %}

{% block col-2 %}
<div class="kb-contentbox-head">
  drinker breakdown
</div>
<div class="kb-contentbox">
  {% chart users_by_volume session 350 250 %}
</div>
{% endblock col-2 %}

{% block extra-content %}
<div class="kb-main-content">
  <div class="kb-twocol-left">
    <div class="kb-contentbox-head">
      drinkers by volume
    </div>
    <div class="kb-contentbox">
      {% for chunk in session.UserChunksByVolume %}
        <table border="0">
        <tr>
        <td align="center" valign="center">
          <div class="kb-drink-box-mugshot">
            {% with chunk.user as drinker %}
              {% mugshot_box drinker 96 %}
            {% endwith %}
            {% if chunk.user %}{{ chunk.user }}{% else %}anonymous{% endif %}
          </div>
        </td>
        <td align="center" valign="center">
          <p>
          {% chart user_session_chunks chunk 370 100 %}
          </p>
        </td>
        </tr>
        </table>
      {% endfor %}
    </div>
  </div>
  <div class="kb-twocol-right">
    <div class="kb-contentbox-head">
      pours
    </div>
    <div class="kb-contentbox">
      {% for drink in session.drinks.all %}
        {% include "kegweb/drink-box.html" %}
      {% endfor %}
    </div>
  </div>
  <div class="clear">&nbsp;</div>
</div>
{% endblock extra-content %}
